{extend name="vehicle@common/base" /} {block name="leftmenu"}{include
file="common/leftMenu" /} {/block}{block name="main"} {include
file="common/ie8warning" /}
<script>
	// include file="common/jq_cookie_js"}
{include file="common/jq_cookie_js"}
</script>
<style>
.data-tr {
	cursor: pointer;
}
</style>
<link rel="stylesheet"
	href="__PUBLIC__/static/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<script
	src="__PUBLIC__/static/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script
	src="__PUBLIC__/static/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js"></script>
<div class="htmltitle">
	<h2>
		用车统计
		<button class="btn btn-default btn-lg" data-toggle="modal"
			data-target="#myModal">条件筛选</button>
		<a class="btn btn-default btn-lg" href="">清除筛选条件</a>
	</h2>

</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel">
	<div class="modal-dialog modal-sm" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title" id="myModalLabel">条件筛选</h4>
			</div>
			<div class="modal-body">
				<form id="tabulationForm" method="post">
					<div class="form-group">
						<label for="startTime">起始日期</label> <input type="text"
							class="form-control form_datetime" id="startTime"
							name="startTime" placeholder="点击选择，默认查询今年" readonly>
					</div>
					<div class="form-group">
						<label for="stopTime">结束日期</label> <input type="text"
							class="form-control form_datetime" id="stopTime" name="stopTime"
							placeholder="默认为今天" readonly>
					</div>
					<div class="form-group">
						<label for="stopTime">司机筛选：</label> <input type="text"
							class="form-control" id="filterInput" name="filterInput"
							placeholder="选择司机车辆"
							onclick="openSelectWins('getDriverList.html','选择司机车辆信息')"
							style="width: 240px;" />
					</div>
					<div class="form-group">
						<button type="reset" class="btn btn-danger">重置</button>
					</div>
					<input type="hidden" name="driverId" id="driverId" /> <input
						type="hidden" name="_method" value="PUT" />
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" onclick="postSearch()">筛选</button>
			</div>
		</div>
	</div>
</div>


<div></div>
<div id="gridbox" style="width: 95%; margin-top: 10px;">
	<table class="table table-striped table-hover table-condensed">
		<tbody>
			<tr id="tr_title">
				<th class="id">单号</th>
				<th class="creTime">申请时间</th>
				<th class="depName">申请部门</th>
				<th class="name">申请人</th>
				<th class="destination">目的地</th>
				<th class="beginTime">出发时间</th>
				<th class="reson">事由</th>
				<th class="driverInfo">司机车辆</th>
			</tr>

		</tbody>
	</table>
	<div style="position: absolute; top: 450px; left: 50px;">{$page}</div>
</div>
<div class=""></div>


<script>
	function postSearch() {
		$("#tabulationForm").attr("action", "{$Request.baseUrl}").submit();
		//$.post("{$Request.baseUrl}",{startTime:$("#startTime").val(),stopTime:$("#stopTime").val(),},function(data){
		//	reloadData(data);
		//});
	}
	var json = {$json};
	$(function() {
		$("#startTime").val($.cookie("startTime"));
		$("#stopTime").val($.cookie("stopTime"));
		$("#filterInput").val($.cookie("filterInput"));
		$('.form_datetime').datetimepicker({
			format : 'yyyy-mm-dd',
			language : 'zh-CN',
			todayBtn : 1,
			autoclose : 1,
			todayHighlight : 1,
			//showMeridian : 1,
			startView : 2,
			minView : 2
		});
		var html = "";
		for (var i in json){
			html += '<tr id="'+json[i]['id']+'" class="data-tr">';
			html += '<td>'+json[i]['id']+'</td>'
			+ '<td>'+json[i]['creTime']+'</td>'
			+ '<td>'+json[i]['depName']+'</td>'
			+ '<td>'+json[i]['name']+'</td>'
			+ '<td>'+json[i]['destination']+'</td>'
			+ '<td>'+json[i]['beginTime']+'</td>'
			+ '<td>'+json[i]['reson']+'</td>'
			+ '<td>'+json[i]['driverInfo']+'</td>';	
			html += '</tr>';
		}
		html = html.replace(/null/g,'-');
		$("#gridbox table tbody").append(html);
		$("#gridbox tr.data-tr").click(function() {
			//window.open('detail.html?d=' + $(this).attr('id'));
			location.href = 'detail.html?d=' + $(this).attr('id');
		});
	});
	function resetForm() {
		$("#tabulationForm").reset();
	}
	function openSelectWins(url, title) {
		$.getScript("__PUBLIC__/static/zDialog/zDialog.js", function() {
			$.getScript("__PUBLIC__/static/zDialog/zDrag.js", function() {
				var diag = new Dialog();
				diag.Width = _htmlWidth * 0.6;
				diag.Height = _htmlHeight * 0.6;
				diag.Title = title != undefined ? title : "";
				diag.URL = url;
				diag.OKEvent = function() {
					var driverId = diag.innerFrame.contentWindow.document
							.getElementById('a1').value;
					var driverInfo = diag.innerFrame.contentWindow.document
							.getElementById('a2').value;
					okEnv(driverId, driverInfo);
				};
				diag.show();
				function okEnv(driverId, driverInfo) {
					diag.close();
					if (driverId != '') {
						$("#filterInput").val(driverInfo);
						$("#driverId").val(driverId);
					}
				}
			});
		});
	}
</script>

















{/block}
